
#include "atomic_op_asm.h"

#ifdef _ARM_ARCH_6

ENTRY_NP(_membar_producer)
#ifdef _ARM_ARCH_7
	dsb
#else
	mov	r0, #0
	mcr	p15, 0, r0, c7, c10, 4	 /* Data Synchronization Barrier */
#endif
	RET
END(_membar_producer)
ATOMIC_OP_ALIAS(membar_producer,_membar_producer)
ATOMIC_OP_ALIAS(membar_write,_membar_producer)
STRONG_ALIAS(_membar_write,_membar_producer)

ENTRY_NP(_membar_sync)
#ifdef _ARM_ARCH_7
	dmb
#else
	mov	r0, #0
	mcr	p15, 0, r0, c7, c10, 5	/* Data Memory Barrier */
#endif
	RET
END(_membar_sync)
ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
ATOMIC_OP_ALIAS(membar_enter,_membar_sync)
ATOMIC_OP_ALIAS(membar_exit,_membar_sync)
ATOMIC_OP_ALIAS(membar_consumer,_membar_sync)
ATOMIC_OP_ALIAS(membar_read,_membar_sync)
CRT_ALIAS(__sync_synchronize,_membar_sync)
STRONG_ALIAS(_membar_enter,_membar_sync)
STRONG_ALIAS(_membar_exit,_membar_sync)
STRONG_ALIAS(_membar_consumer,_membar_sync)
STRONG_ALIAS(_membar_read,_membar_sync)

#endif /* _ARM_ARCH_6 */
